package services;

import homes.GenericHome;
import java.io.Serializable;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;

@SuppressWarnings("serial")
public class GenericService<T> implements Serializable{
	
	private GenericHome<T> home;

    @Transactional
    public void delete(final T object) {
        this.getHome().delete(object);
    }

    @Transactional
    public List<T> retriveAll() {
        return this.getHome().findAll();
    }

    @Transactional
    public void save(final T object) {
        this.getHome().save(object);
    }

    @Transactional
    public void update(final T object) {
        this.getHome().update(object);
    }
	
	public GenericHome<T> getHome() {
		return home;
	}

	public void setHome(GenericHome<T> home) {
		this.home = home;
	}

}
